<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<html>
<body>
<canvas id="c">
<script>
test(function(t) {
    var ctx = document.createElement('canvas').getContext('2d');

    ctx.fillStyle = '#0f0';
    ctx.fillRect(0, 0, 20, 20);

    var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
    g.addColorStop(0, '#f00');
    g.addColorStop(1, '#f00');
    ctx.strokeStyle = g;
    ctx.font = '1px sans-serif';
    ctx.strokeText("AA", 0, 1);

    var result = ctx.getImageData(5,5,10,10).data;
    console.log(result[0]);
    console.log(result[1]);
    console.log(result[2]);
    console.log(result[3]);
    assert_approx_equals(result[0]*result[3]/255, 0, 10);
    assert_approx_equals(result[1]*result[3]/255, 255, 10);
    assert_approx_equals(result[2]*result[3]/255, 0, 10);
}, "Series of tests to ensure that strokeText() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.");
</script>
</body>
</html>
